package com.jianshuai.fallback;

import com.jianshuai.domain.User;
import com.jianshuai.feign.UserFeignClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {
    /*
     * @Description: 熔断托底方法
     * @param throwable: 
     * @return: cn.itsource.feigenClients.UserFeignClient
     **/
    @Override
    public UserFeignClient create(Throwable throwable) {
        return id -> new User(-1L, "触发熔断, 服务不可用，请稍后重试！");
    }
}